/*
 * Copyright 2013-2015 the original author or authors.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.xdtech.parking.protocol.manager;

import java.util.List;

import com.xdtech.common.service.impl.BaseService;
import com.xdtech.common.utils.JsonUtil;
import com.xdtech.core.model.BaseModel;
import com.xdtech.parking.model.ParkingDevice;
import com.xdtech.parking.protocol.util.ParkRedis;
import com.xdtech.parking.protocol.vo.DeviceInfo;

/**
 * 
 * @author max.zheng
 * @create 2015-6-20下午2:19:48
 * @since 1.0
 * @see
 */
public class DeviceProtocol {
	
	public static void initingToCache(BaseService<BaseModel> baseService) {
		Object obj = baseService.findByHql("from ParkingDevice");
		List<ParkingDevice> parkingDevices = (List<ParkingDevice>) obj;
		
//		List<DeviceInfo> items = DeviceInfo.createItems(parkingDevices);
		for (ParkingDevice parkingDevice : parkingDevices) {
			ParkRedis.setAreaDeviceInfo(parkingDevice);
		}
	}
	
}
